# -*- coding: utf-8 -*-
from core.http import http_client


def login(ip, user_id):
    url = "http://" + ip + ":8306/web-admin/login/loginForTest"
    token = "543654654"
    data = {
        "key": user_id,
    }
    result = http_client.post(url=url, data=data, token=token)
    print(result)
    return result['data']['token']


def call_admin(ip, token, api, data):
    url = "http://" + ip + ":8306/web-admin" + api
    return http_client.post(url=url,
                            data=data,
                            token=token)
